//
//  CaretakerViewController.m
//  ALittleReminder
//
//
//  Created by Arsh Bhullar on 11-11-03.
//

#import "CaretakerViewController.h"
#import "CareTakerAccount.h"

@implementation CaretakerViewController

-(IBAction)onClickClose:(id)sender{
    
    
    [self dismissModalViewControllerAnimated:YES];
    
}

-(IBAction)onClickEdit:(id)sender{
    CareTakerAccount *openView = [[CareTakerAccount alloc] initWithNibName:nil bundle:nil];
    [self presentModalViewController:openView animated:YES];
}



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{       
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *docDir = [paths objectAtIndex: 0];
    NSString *docFile = [docDir stringByAppendingPathComponent: @"caretakerInfo.txt"];
    
    NSString *textfromfile = [NSString stringWithContentsOfFile:docFile encoding:NSStringEncodingConversionAllowLossy error:nil];
    
    NSArray *info = [textfromfile componentsSeparatedByString:@"-"];
    
    name.text = [info objectAtIndex:0];
    hospital.text = [info objectAtIndex:1];
    city.text = [info objectAtIndex:2];
    phone.text = [info objectAtIndex:3];
    
   
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
